<?php 

    

$link = mysql_connect('localhost', 'root', 'qwerty');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}


$db_selected = mysql_select_db('data', $link);
if (!$db_selected) {
    die ('Can\'t use foo : ' . mysql_error());
}


if(isset($_POST['username'])==true && isset($_POST['content'])==true){
 $insert = mysql_query("INSERT INTO  `data`.`coments` (`coments_id` ,`content_id` ,`name` ,`coments` ,`date`) 
VALUES(NULL ,  '2',  '".$_POST['username']."',  '".$_POST['content']."', UTC_DATE())");
if (!$insert) {
    die ('Can\'t use foo : ' . mysql_error());
}
header("Location: http://localhost/coments-ajax/"); 
exit;
}
